﻿@inject NetCoreCMS.IServices.IArticle_categoryService _article_category
@{
    Layout = null;
    Sysconfig config = ViewData["config"] as Sysconfig;
    List<Article> focusList = ViewBag.focusList as List<Article>;
    List<Article> newsList = ViewBag.newsList as List<Article>;
    List<Article> redList = ViewBag.redList as List<Article>;
    List<Article> hotList = ViewBag.hotList as List<Article>;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>新闻资讯</title>
    <link rel="stylesheet" type="text/css" href="/mobile/css/idangerous.swiper.css" />
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/common.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/idangerous.swiper-2.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var mySwiper = new Swiper('.swiper-container', {
                calculateHeight: true,
                resizeReInit: true,
                pagination: ".pagination",
                autoplay: 5000,
                paginationClickable: true
            });
        });
    </script>
</head>

<body id="news" ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>新闻资讯</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" href="javascript:;" onclick="showDialogBox('#category-box');">
                    <i class="iconfont icon-nav"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->
        <!--页面内容-->
        <div class="page__bd">
            <!--首页幻灯片-->
            <div id="slider" class="swiper-container">
                <div class="swiper-wrapper">
                    @foreach (Article dr in focusList)
                    {
                        <div class="swiper-slide">
                            <a asp-action="Show" asp-route-id="@dr.id">
                                <img src="@dr.img_url" />
                            </a>
                        </div>
                    }
                </div>
                <div class="pagination"></div>
            </div>
            <!--/首页幻灯片-->
            <!--最新资讯-->
            <div class="weui-panel weui-panel_access" style="margin-top:0;">
                <div class="weui-panel__hd">最新资讯</div>
                <div class="weui-panel__bd">
                    <div class="txt-list">
                        <ul>
                            @for (int i = 0; i < newsList.Count; i++)
                            {
                                if (i == 0)
                                {
                                    <li>
                                        <a asp-action="Show" asp-route-id="@newsList[i].id">
                                            <img src="@newsList[i].img_url" />
                                            <h2>@newsList[i].title</h2>
                                            <p class="intro">@newsList[i].zhaiyao</p>
                                        </a>
                                    </li>
                                }
                                else
                                {
                                    <li>
                                        <a asp-action="Show" asp-route-id="@newsList[i].id">
                                            <i class="date">@newsList[i].add_time.ToString("MM-dd")</i>
                                            <span class="text">@newsList[i].title</span>
                                        </a>
                                    </li>
                                }
                            }
                        </ul>
                    </div>
                </div>

            </div>
            <!--最新资讯-->
            <!--图片资讯-->
            <div class="weui-panel weui-panel_access">
                <div class="weui-panel__hd">图片资讯</div>
                <div class="weui-panel__bd">
                    <div class="txt-list">
                        <ul>
                            @foreach (Article dr in redList)
                            {
                                <li>
                                    <a asp-action="Show" asp-route-id="@dr.id">
                                        <img src="@dr.img_url" />
                                        <h2>@dr.title</h2>
                                        <div class="note">
                                            <p>@dr.zhaiyao</p>
                                            <p>
                                                <i class="hot">@dr.click 人</i>
                                                <i class="date">时间：@dr.add_time.ToString("yyyy-MM-dd")</i>
                                            </p>
                                        </div>
                                    </a>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
            <!--/图片资讯-->
            <!--人气排行-->
            <div class="weui-panel weui-panel_access">
                <div class="weui-panel__hd">人气排行</div>
                <div class="weui-panel__bd">
                    <div class="txt-list">
                        <ul>
                            @for (int i = 0; i < hotList.Count; i++)
                            {
                                <li>
                                    <a asp-action="Show" asp-route-id="@hotList[i].id">
                                        <i class="date">@hotList[i].click 次</i>
                                        <i class="number">@(i + 1)</i>
                                        <span class="text">@hotList[i].title</span>
                                    </a>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
            <!--/人气排行-->
            <!--版权信息-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
            <!--/版权信息-->
            <!--底部导航-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Footer.cshtml")
            <!--/底部导航-->
        </div>
        <!--/页面内容-->
    </div>

    <!--类别容器-->
    <div id="category-box" class="dialog-wrap">
        <div class="dialog-box">
            <div class="header">
                <a class="back" href="javascript:;" onclick="closeDialogBox('#category-box');">
                    <i class="iconfont icon-arrow-left"></i>
                </a>
                <h3>栏目类别</h3>
            </div>
            <ul class="navbar">
                @{var categoryList1 = _article_category.GetChildList(0, 0, 1);}
                @foreach (Article_category cdr1 in categoryList1)
                {
                    <li>
                        <h3><a asp-action="List" asp-route-id="@cdr1.id">@cdr1.title</a></h3>
                        <p>
                            @{var categoryList2 = _article_category.GetChildList(0, cdr1.id, 1);}
                            @foreach (Article_category cdr2 in categoryList2)
                            {
                                if (cdr2.id == Model.category_id)
                                {
                                    <a asp-action="List" asp-route-id="@cdr2.id" class="selected">@cdr2.title</a>
                                }
                                else
                                {
                                    <a asp-action="List" asp-route-id="@cdr2.id">@cdr2.title</a>
                                }
                            }
                        </p>
                    </li>
                }
            </ul>
        </div>
    </div>
    <!--类别容器-->

</body>
</html>
